import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;

public class test {
    public test() {
    }

    public static String SendRequest(String url, String method, Course course) {
        String result = "";
        String parameter = "kcdm=" + course.getKcdm() + "&addid=" + course.getAddid() + "&xnxq=" + course.getXnxq() + "&jxjhh=" + course.getJxjhh()
                +"&keyinfo="+course.getKeyinfo()+"&_="+course.get_();
        BufferedReader in = null;

        try {
            url = url + "?" + parameter;
            HttpURLConnection httpURLConnection = (HttpURLConnection)(new URL(url)).openConnection();
            httpURLConnection.setRequestProperty("Charset", "UTF-8");
            httpURLConnection.setRequestMethod(method);
            httpURLConnection.setRequestProperty("accept", "*/*");
            httpURLConnection.setRequestProperty("X-Requested-With", "XMLHttpRequest");
            httpURLConnection.setRequestProperty("Referer", "http://218.197.102.183/Course/login.do?msg=SIhC6%2BU6Ze3WrQcrkBC%2F885hxa0GVNd4slbygqwqrdOVsXMmjL5Mk%2BQSWua5QNBaLZjLRCg64PLt%0A2R0lekELmBmuIs%2FOORZUjOHNPemI1Z4dwxOHQ%2B7wtDFxBAWjDjYBH79MLQZyPHwBrmGVOfKDKuVz%0AikEb7rZC9ht6KnQm%2BLc%3D%0A%23HAHdGfMTd9Rad2PEJCjALbQ2EzKgwxnHH18ra40ptgw9D2xXBORb2z9qua3a3bkki901hRx0hD3Y%0AsQICy%2F2ttRGlaa8shzJ4Qa1AEctHIBxLTQFWtXTOylmxm9DQlHURTSgN0eLX4kJkRgxg%2FODMvV%2FW%0Aou4fzTSW1QsaVbYkndA%3D%0A%23pV05zl8VkkFK8wyiM5U9l30IPenbuVZQb33CMkiWqPVXaD8qtB71X%2BRhVgKPhUWCuwt8zOQoHohq%0AwAWI8aafjn7IUg8Sc0RG%2F9nerjMgB74g1MOjWfvOQ3E279NBKCY0B8Cn9AskX7wiC1JJsUwdwz8R%0ABxcNQa5ovjb6z%2BlTDTE%3D%0A%23Ji3OE6dgtfQtXe2aI%2BVcr2BTit%2Fjrj21vk%2FCSmK6rMX10X9dn8ZZXPfDnoNvTD2f3Nasv1%2BOlnIJ%0AdzzABQ3cvfF4oAe85h8eB62K5Udx%2FRtT00T9HMKMxHC4UvWQbDxK8wvVvLqHn1CMamhNwM5uNFfC%0AkeEclKSUhLNNOtPh6QQ%3D%0A%23oEOSDYPMpK8eQpUbpvfPOuUJQDrs%2BC0m1z5RkjvyQiBXFwMFI4rsJ6wKDHsMiGzPV31ifzyd7E8r%0AMLT0cu7%2BqZTkq3VLljwnQBcyL8QG%2Fpccrl%2BauAh6y7T%2F4y67EMjtWXicdYoTtAzWaPCBud6e3UHf%0AW4Q98GKtIciH%2FNbkNJM%3D%0A%23");
            httpURLConnection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36");
            httpURLConnection.setRequestProperty("Accept-Encoding", "deflate, sdch");
            httpURLConnection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8");
            httpURLConnection.setRequestProperty("Cookie", "JSESSIONID=" + course.getJSESSIONID());
            httpURLConnection.connect();
            in = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));

            String line;
            for(result = ""; (line = in.readLine()) != null; result = result + line) {
                ;
            }
        } catch (IOException var16) {
            System.out.println("你干啥呢咋给IO异常了呢？");
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException var15) {
                    System.out.println("你干啥呢咋给IO异常了呢？");
                }
            }

        }

        return result;
    }

    public static void main(String[] args) {
        ArrayList<Course> courses = new ArrayList();
        ObjectMapper objectMapper = new ObjectMapper();

        try {
            File file = new File("information.txt");
            file.createNewFile();
            FileInputStream fileInputStream = new FileInputStream(file);
            BufferedReader in = new BufferedReader(new InputStreamReader(fileInputStream));
            Course course = null;
            String course_json = null;

            while((course_json = in.readLine()) != null) {
                course = (Course)objectMapper.readValue(course_json, Course.class);
                courses.add(course);
            }
        } catch (IOException var9) {
            System.out.println("你干啥呢咋给IO异常了呢？");
        }

        int i = 0;

        while(true) {
            ++i;

            try {
                Iterator var11 = courses.iterator();

                while(var11.hasNext()) {
                    Course course = (Course)var11.next();
                    course.set_(String.valueOf(System.currentTimeMillis()));
                    String s = SendRequest("http://218.197.102.183/Course/cxkxkAdd.do", "GET", course);
                    System.out.println("[" + i + "]" + s);
                    Thread.sleep(300L);
                }
            } catch (InterruptedException var8) {
                System.out.println("你干啥呢我就是线程休眠0.2s也能异常？");
            }
        }
    }
}